﻿<?php $Id = $_REQUEST["Id"]; 
	include_once 'ConnectHelper.inc';
	if(!isset($_REQUEST['page'])){  
		$page = 1;  
} else {  
$page = $_REQUEST['page'];  
}  
$max_results = 20;  
$from = (($page * $max_results) - $max_results);  
$sql = Run_QueRy("SELECT * FROM product where product.menuId = $Id LIMIT $from, $max_results");   
while ($row = mysql_fetch_array($sql)) { 
?>
<div class='mainProduct' onmouseout="hideddrivetip()" onmouseover="ddrivetip('<img  src=\'<?php echo $row[2];?>\' width=250 height=250><br>Tên Tác Phẩm<br>Giá : 1000$<br> size : 100X100')" >
<?php
echo "<img src='$row[2]' alt='image' /> </div>";  
}  
$total_results = mysql_result(Run_QueRy("SELECT COUNT(*) as Num FROM product where product.menuId = $Id"),0); 
$total_pages = ceil($total_results / $max_results);  
echo "<div class='mainProduct'>";  
if($page > 1){  
$prev = ($page - 1);  
echo "<a href='#' onClick='PhanTrang($Id,$prev)'>Trang trước</a>&nbsp;";  
}  
for($i = 1; $i <= $total_pages; $i++){  
if(($page) == $i){  
echo "$i&nbsp;";  
} else {  
echo "<a href='#' onClick='PhanTrang($Id,$i)'>$i</a>&nbsp;";  
}  
}  
if($page < $total_pages){  
$next = ($page + 1);  
echo "<a href='#' onClick='PhanTrang($Id,$next)'>Trang tiếp theo</a>";  
}  
echo "</div>";  
?>


